#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 crane <crane@his-pc>
#
# Distributed under terms of the MIT license.

"""

"""

class Solution:
    def removeDuplicates(self, nums):
        dup_cnt = 0
        for i in range(len(nums)-1, 1, -1):
            if nums[i] == nums[i-1] and nums[i] == nums[i-2]:
                nums.pop(i)
                # dup_cnt += 1

        # return len(nums) - dup_cnt
        return len(nums)


def main():
    print("start main")

    l = [1, 2, 2, 2, 3, 3, 3]
    s = Solution()
    ret = s.removeDuplicates(l)
    print(ret)
    print(l)

if __name__ == "__main__":
    main()
